
var selectedPhotoUrls = [];
var url = location.href;
var userId;
var albumId;
var photoId;
//g+
    if(url.indexOf("plus.google.com") > 0) {
	var els = document.querySelectorAll("div[aria-selected='true'] >div >div >div >img");
	for(var idx=0; idx < els.length; idx++) {
	    var el = els[idx];
	    selectedPhotoUrls.push(el.src);
        }

//picasaweb
    } else if (url.indexOf("picasaweb.google.com") > 0 ) {
        var sections = url.split("picasaweb.google.com/")[1].split('?')[0].split('/');
        if(url.indexOf("#") > 0 && url.split("#").length > 0 && url.split("#")[1].length > 0) {
           photoId = url.split("#")[1];
	}
        if (sections[0] == 'lh' && sections[1] == 'reorder' ){
            var els = document.querySelectorAll(".lhcl_selectBox:not([style*='visibility:hidden']):not([style*='visibility: hidden'])");
            var foundSelected = true;
            if (els.length ==0) { // nothing selected
		els = document.querySelectorAll(".lhcl_slideImage");
                foundSelected = false;
	    }

	    userId = url.split('?')[1].split('&')[0].split('=')[1];
	    albumId = url.split('?')[1].split('&')[1].split('=')[1];

	    for(var idx=0; idx < els.length; idx++) {
		var el = foundSelected ? els[idx].parentNode : els[idx];
		selectedPhotoUrls.push(el.style.background.replace('url(', '').replace(')',''));
            }

	} else if (sections.length == 2 && !photoId ){
            var els = document.querySelectorAll(".goog-icon-list > div > div > div > a > div > img");
	    for(var idx=0; idx < els.length; idx++) {
		var el = els[idx].parentNode;
		selectedPhotoUrls.push(el.src);
            }
	}
    }

var ret = {
url: url,
userId: userId,
albumId : albumId,
photoId : photoId,
selectedPhotoUrls : selectedPhotoUrls
};

console.log(ret);

ret;
